local pz = {
    ['N'] = 1,
    ['R'] = 2,
    ['SR'] = 3,
    ['SSR'] = 4,
    ['UR'] = 5,
    ['UR+'] = 5,
}

class.card_data = extends(class.button) {
    new = function (parent,x,y,w,h)
        local panel = class.card_data:builder 
        {
            parent = parent,
            x = x,
            y = y,
            w = w,
            h = h,
        }
        return panel
    end,

    init = function (self)
        class.button.init(self)
        self.card_color = {
            self:add_frame('card_1'),
            self:add_frame('card_2'),
            self:add_frame('card_3'),
            self:add_frame('card_4'),
            self:add_frame('card_5'),
        }
        self:add_panel([[textures\black32.blp]],10,10,self.w-20,self.h - 20)
        self.title = self:add_text('名称',0,10,nil,50,14,5)
        self.icon = self:add_panel('1',(self.w-96)/2,55,96,96)
        self.frame = self.icon:add_panel('')
        self.jb = self:add_text('羁绊<|cffffff00斗破苍穹|r>',0,160,nil,30,14,5)
        self.tx = self:add_text('体系',0,190,nil,30,10,5)
        self.text = self:add_text('内容介绍',10,220,self.w-20,self.h-200,10)
        --自动换行
        self.text:set_width(self.text.w)
        self.highlight = self:add_panel([[ui\选中框.tga]],-20,-20,self.w+40,self.h+40)
        self.highlight:hide()
        return self
    end,
    set_data = function(self,skill)
        local id = pz[skill['品质']]
        self.skill = skill
        self.frame:set_normal_image(skill.frame_art)
        self.icon:set_normal_image(skill.art)
        self.title:set_text(skill.title or skill.name)
        self.text:set_text(skill.card_tip)
        self.jb:set_text(('羁绊<|cffffff00%s|r>'):format(skill['分类4'] or skill['分类1']))
        self.tx:set_text(skill['标签'])
        for i,ui in ipairs(self.card_color) do
            if i==id then
                ui:show()
            else
                ui:hide()
            end
        end
    end,
}